package Topic10;

import java.util.ArrayList;

public class StudentH {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student a = new Student("1","张三");
        Student b = new Student("2","李四");
        Student c = new Student("3","王五");
        list.add(a);
        list.add(b);
        list.add(c);
        System.out.println(list);
        System.out.println("[-------------------------------------]");
        for (int i = 0; i < list.size(); i++) {
           Student d = list.get(i);
           if (d.getName().equals("张三")){
               d.setName("张三丰");
           }if (d.getName().equals("王五")){
               list.remove(d);
            }
        }
        System.out.println(list);
    }
}
